(function(){
	angular.module('app').factory('globalCategoryComponentSservice',globalCategoryComponentSservice);

	globalCategoryComponentSservice.$inject = ['util','$q'];

	function globalCategoryComponentSservice(util,$q){
		return {
			get: _get,
			getCat: _getCat
		}

		function _get(json){

			var defer = $q.defer();

			util.$get({
				url: '/marketconditions/index/getCategory.htm'
			}).then(function(resp){

				defer.resolve(resp.value);

			},function(err){

				defer.reject(err);

			});	

			return defer.promise;

		}

		function _getCat(catValue){
			var defer = $q.defer();

			util.$get({
				url: '/marketconditions/category/getItemCategory.htm',
				data:{
					catValue:catValue
				}
			}).then(function(resp){

				defer.resolve(resp.value);

			},function(err){

				defer.reject(err);

			});	

			return defer.promise;
		}
	}
})();